﻿using Microsoft.Xna.Framework;
using System.Collections.Generic;
using System;

namespace XNADota.Camera
{
    public class CameraManager : GameComponent
    {
        private List<BaseCamera> _CameraList;
        private BaseCamera _ActiveCamera;

        public CameraManager(Game game)
            : base(game)
        {
            _ActiveCamera = null;
            _CameraList = new List<BaseCamera>();
            _CameraList.Clear();
        }

        public BaseCamera ActiveCamera
        {
            get { if (_ActiveCamera == null) throw new Exception("There is no active camera."); return _ActiveCamera; }
        }

        public void Add(BaseCamera camera)
        {
            _ActiveCamera = camera;
            _CameraList.Add(camera);
        }

        public override void Update(GameTime gameTime)
        {
            ActiveCamera.Update(gameTime);

            base.Update(gameTime);
        }
    }
}
